package com.zsh.activities;

import com.zsh.prototype.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

public class SplashScreen extends Activity {
	private static int SPLASH_TIME_OUT = 3000;
	private boolean mIsBackButtonPressed = false;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		new Handler().postDelayed(new Runnable() {
			
			@Override
			public void run() {
				finish();
                
                if (!mIsBackButtonPressed) {
					Intent i = new Intent(SplashScreen.this, MainActivity.class);
					startActivity(i);
               }
			}
		}, SPLASH_TIME_OUT);
	}
	
	
	@Override
	public void onBackPressed() {
		mIsBackButtonPressed = true;
		super.onBackPressed();
	}
}
